package com.v5.mr.serializable.java;

import java.io.FileOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;

public class StudentMain {

	public static void main(String[] args) throws Exception {
		//创建一个学生对象
		Student s = new Student();
		s.setStuID(1);
		s.setStuName("Tom");
		
		//将该对象保存到文件 -----> 序列化
		OutputStream out = new FileOutputStream("d:\\temp\\student.ooo");
		ObjectOutputStream objOut = new ObjectOutputStream(out);
		
		//输出对象
		objOut.writeObject(s);
		
		//关闭
		objOut.close();
		out.close();
		
		System.out.println("完成");
		
		// 通过ObjectInputStream反序列化
//		ObjectInputStream
	}
}
